﻿@using EasyToHelp.Entity;
@model ReceiveAddress;
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑收获地址</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <!--标准mui.css-->
    <link href="~/css/mui.min.css" rel="stylesheet" />
    <link href="~/css/app.css" rel="stylesheet" />
    <link href="~/css/mui.picker.css" rel="stylesheet" />
    <link href="~/css/mui.poppicker.css" rel="stylesheet" />

    <style>
        .title {
            margin: 20px 15px 7px;
            color: #6d6d72;
            font-size: 15px;
        }

        .mui-btn {
            font-size: 16px;
            padding: 8px;
            margin: 3px;
        }

        h5.mui-content-padded {
            margin-left: 3px;
            margin-top: 20px !important;
        }

            h5.mui-content-padded:first-child {
                margin-top: 12px !important;
            }

        .ui-alert {
            text-align: center;
            padding: 20px 10px;
            font-size: 16px;
        }

        input {
            color: #000;
        }
    </style>
</head>
<body>
    <header class="mui-bar mui-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
        <h1 class="mui-title">编辑收获地址</h1>
        <a class="mui-pull-right" style="margin-top:15px;" onclick="UpData(@Model.ID)">保存</a>

    </header>
    <div class="mui-content" style="margin-top:10px;">

        <form class="mui-input-group">
            <div class="mui-input-row">
                <a class="mui-navigate-right">
                    <input type="text" placeholder="收货人" id="ReNames" value="@Model.ReNames">
                </a>
            </div>
            <div class="mui-input-row">

                <input type="text" placeholder="手机号码" id="Rephone" value="@Model.Rephone">
            </div>

            <div class="mui-input-row">
                <a class="mui-navigate-right" id="showCityPicker3">
                    <input type="text" id="City" value="@Model.province @Model.citys @Model.areas" class="mui-input-clear" placeholder="所在地区" disabled="disabled">
                </a>
            </div>
            <div class="mui-input-row" style="margin: 10px 5px 0PX; height:auto;">
                <textarea id="textarea" rows="3" placeholder="详细地址: 如道路、门牌号、小区、楼栋号、单元室等">@Model.detailaddres</textarea>
            </div>
            @if (Model.defaultaddress == "true")
            {
                <ul class="mui-table-view">
                    <li class="mui-table-view-cell">
                        <span style="color:gray">设为默认地址</span>
                        <div class="mui-switch mui-active" id="M_Toggle">
                            <div class="mui-switch-handle"></div>
                        </div>
                    </li>
                </ul>
            }
            else
            {
                <ul class="mui-table-view">
                    <li class="mui-table-view-cell">
                        <span style="color:gray">设为默认地址</span>
                        <div class="mui-switch " id="M_Toggle">
                            <div class="mui-switch-handle"></div>
                        </div>
                    </li>
                </ul>
            }
            <input type="hidden" value="@Model.ID" id="ID" />
            <input type="hidden" value="@Model.UserId" id="UserId" />
            <input type="hidden" value="true" id="defaultaddress" />
        </form>
        @if (Model.ID != 0)
        {
            <ul class="mui-table-view">
                <li class="mui-table-view-cell" style="color:red;" onclick="DelteData(@Model.ID)">删除当前收货地址</li>
            </ul>
        }

    </div>
    <script src="~/js/mui.min.js"></script>
    <script src="~/js/mui.picker.js"></script>
    <script src="~/js/mui.poppicker.js"></script>
    <script src="~/js/city.data.js"></script>
    <script src="/js/city.data-3.js"></script>
    <script src="~/js/jquery.min.js"></script>
    <script src="~/js/SubAction.js"></script>
    <script src="/js/AddressData.js"></script>
    <script>
        (function ($, doc) {
            $.init();
            $.ready(function () {
                var cityPicker3 = new $.PopPicker({
                    layer: 3
                });
                cityPicker3.setData(cityData3);
                var showCityPickerButton = doc.getElementById('showCityPicker3');
                var cityResult3 = doc.getElementById('cityResult3');
                showCityPickerButton.addEventListener('tap', function (event) {
                    cityPicker3.show(function (items) {
                        // cityResult3.innerText = "你选择的城市是:" + (items[0] || {}).text + " " + (items[1] || {}).text + " " + (items[2] || {}).text;
                        doc.getElementById('City').value = (items[0] || {}).text + " " + (items[1] || {}).text + " " + (items[2] || {}).text;
                        //返回 false 可以阻止选择框的关闭
                        //return false;
                    });
                }, false);
            });
            //圆角列表开关处理
            document.getElementById("M_Toggle").addEventListener('toggle', function (e) {
                var isActive = e.detail.isActive;
                document.getElementById('defaultaddress').value = isActive;
            });
        })(mui, document);
    </script>
</body>

</html>
